<?
include("./_common.php");
include("$g4[path]/_head.php");

if(!$order_step1)
{
	echo("<script>location.href='".$g4[path]."/bbs/login.php?url=".$g4[path]."/shop/order_step1.php&mod=shop';</script>");
	exit;
}

$shop = get_shop();
$goods_dir = $g4[path]."/data/goods/";
$CART = explode("/",$_SESSION["g4_cart"]);

?>
<link rel="stylesheet" href="<?=$g4['path']?>/shop/style.css" type="text/css">
<script language="javascript" src="<?=$g4['path']?>/shop/shop.js"></script>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<form name="order_step1" method="post" action="order_step2.php">
<input type="hidden" name="o_mb_id" value="<?=$member[mb_id]?>">
	<tr>
		<td>
		<table cellpadding="0" cellspacing="1" border="0" width="100%" style="border:solid 1px #CCCCCC">
			<tr align="center" height="20">
				<td bgcolor="#EFEFEF">상품명</td>
				<td bgcolor="#EFEFEF" width="100">옵션</td>
				<td bgcolor="#EFEFEF" width="80">수량</td>
				<td bgcolor="#EFEFEF" width="80">단가</td>
				<td bgcolor="#EFEFEF" width="80">합계금액</td>
			</tr>
		</table>
		<?
		if(trim($_SESSION["g4_cart"]))
		{
			$tot_price = 0;
			$tot_tranc = $shop[tranc_price];
			$lineCnt = 0;
			for($i=0;$i<count($CART);$i++)
			{
				$tmpField = explode("|",$CART[$i]);
				$tmpGcode = explode("OP",$tmpField[0]);
				$goods = get_goods($tmpGcode[0]);
				$g_option = get_option($goods[g_option],$tmpGcode[1]);
		?>
		<DIV style="width:100%;height:50px;float:left;padding:5 0 5 0;border-bottom:solid 1px #D7D7D7">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" height="50" style="table-layout:fixed">
			<tr>
				<td width="50" rowspan="2"><img src="<?=$goods_dir.$goods[g_img1]?>" width="50" height="50"></td>
				<td width="10" rowspan="2"></td>
				<td>
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tr>
							<td><a href="<?=$goods[href]?>"><b><?=$goods[g_name]?></b></a><br><span style="color:orange"><?=$goods[g_info]?></span></td>
							<td width="100" align="center"><?=$g_option[0]?></td>
							<td width="80" align="center">
							<?=$tmpField[1]?>EA<br>
							</td>
							<td width="80" align="center"><span style="color:#990000"><?=number_format($goods[g_price]+$g_option[1])?>원</span></td>
							<td width="80" align="center"><span style="color:#990000"><b><?=number_format(($goods[g_price]+$g_option[1]) * $tmpField[1])?>원</b></span></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tr>
							<td><span class="subinfo1">제조/판매원&nbsp;:&nbsp;<?=$goods[g_create]?></span>&nbsp;|&nbsp;<span class="subinfo2">원산지&nbsp;:&nbsp;<?=$goods[g_nation]?></span>&nbsp;|&nbsp;<span class="subinfo3">배송료&nbsp;:&nbsp;<?=$goods[tranc]?></span></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		</DIV>
		<?
				$tot_price+= ($goods[g_price] + $g_option[1]) * $tmpField[1];
				if($tot_price >= $shop[tranc_if] || $goods[g_tranc] == "N" || $goods[g_tranc] == "C")
				{
					$tot_tranc = 0;
				}
				$lineCnt++;
			}
		}

		if($lineCnt==0)
		{
			echo("<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100'><tr align='center'><td>장바구니에 상품이 없습니다.</td></tr></table>");
		}
		?>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#EFEFEF">
				<tr align="right" height="30">
					<td>배송비 : <?=number_format($tot_tranc)?>원</td>
					<td>총구매금액 : <?=number_format($tot_price)?>원</td>
				</tr>
				<tr align="right" height="30">
					<td colspan="2"><span style="color:#990000;font-size:16px;font-weight:bold">총금액 : <?=number_format($tot_tranc + $tot_price)?>원</span></td>
				</tr>
			</table>
		<tr>
	</tr>
	<tr>
		<td height="30"></td>
	</tr>
	<tr>
		<td valign="top">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td colspan="2"><span class="orderTabTitle">주문자정보</span></td>
				</tr>
				<tr>
					<td>
						<table cellpadding="3" cellspacing="0" border="0" width="100%" style="border:solid 1px #D7D7D7">
							<tr>
								<td class="orderIndex">주문자명</td>
								<td><input type="text" class="ed" style="width:120px" name="o_name" value="<?=$member[mb_name]?>"></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">전화번호</td>
								<td><input type="text" class="ed" style="width:200px" name="o_tel" value="<?=$member[mb_tel]?>"></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">휴대폰번호</td>
								<td><input type="text" class="ed" style="width:200px" name="o_hp" value="<?=$member[mb_hp]?>"></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">E-mail</td>
								<td><input type="text" class="ed" style="width:250px" name="o_email" value="<?=$member[mb_email]?>"></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">주소</td>
								<td>
									<table width="330" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td height="25"><input class=ed type=text name='o_zip1' size=4 maxlength=3 readonly value='<?=$member[mb_zip1]?>'>
												 - 
												<input class=ed type=text name='o_zip2' size=4 maxlength=3 readonly value='<?=$member[mb_zip2]?>'>
												&nbsp;<button class="postzip" id="o_zip_btn" onclick="win_zip('order_step1', 'o_zip1', 'o_zip2', 'o_addr1', 'o_addr2');">우편번호</button></td>
										</tr>
										<tr>
											<td height="25" colspan="2"><input class=ed type=text name='o_addr1' size=60 readonly value='<?=$member[mb_addr1]?>'></td>
										</tr>
										<tr>
											<td height="25" colspan="2"><input class=ed type=text name='o_addr2' size=60 value='<?=$member[mb_addr2]?>'></td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr><td height="20"></td></tr>
				<tr>
					<td colspan="2"><span class="orderTabTitle">수령자정보</span> <input type="checkbox" id="os_same" onclick="copyBuyer();">주문자정보와 동일</td>
				</tr>
				<tr>
					<td>
						<table cellpadding="3" cellspacing="0" border="0" width="100%" style="border:solid 1px #D7D7D7">
							<tr>
								<td class="orderIndex">수령자명</td>
								<td><input type="text" class="ed" style="width:120px" name="s_name" value=""></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">전화번호</td>
								<td><input type="text" class="ed" style="width:200px" name="s_tel" value=""></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">휴대폰번호</td>
								<td><input type="text" class="ed" style="width:200px" name="s_hp" value=""></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">E-mail</td>
								<td><input type="text" class="ed" style="width:250px" name="s_email" value=""></td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">주소</td>
								<td>
									<table width="330" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td height="25"><input class=ed type=text name='s_zip1' size=4 maxlength=3 readonly value=''>
												 - 
												<input class=ed type=text name='s_zip2' size=4 maxlength=3 readonly value=''>
												&nbsp;<button class="postzip" id="s_zip_btn" onclick="win_zip('order_step1', 's_zip1', 's_zip2', 's_addr1', 's_addr2');">우편번호</button></td>
										</tr>
										<tr>
											<td height="25" colspan="2"><input class=ed type=text name='s_addr1' size=60 readonly value=''></td>
										</tr>
										<tr>
											<td height="25" colspan="2"><input class=ed type=text name='s_addr2' size=60 value=''></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr><td colspan="2" height="1" bgcolor="#D7D7D7"></td></tr>
							<tr>
								<td class="orderIndex">요구사항</td>
								<td><textarea class="tx" name="s_memo" style="width:100%;height:50px"></textarea></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td align="center" height="50">
		<button class="cart_btn1" onclick="order_step2();">다음단계</button>&nbsp;
		<button class="cart_btn1" onclick="location.href='cart.php';">이전단계</button>
		</td>
	</tr>
</form>
</table>
<?
include("$g4[path]/_tail.php");

?>